import QtQuick 1.0

QMLTwitterBase{
    id: _root

    //////////////////////////////////////////////////////////
    // properties

    //////////////////////////////////////////////////////////
    // changed


    //////////////////////////////////////////////////////////
    // signals

    signal responseStatusesShow(string text)
    signal responseStatusesRetweet(string text)
    signal responseStatusesUpdate(string text)


    //////////////////////////////////////////////////////////
    // methods

    // Show user objects of up to 100 members who retweeted the status.
    // https://dev.twitter.com/docs/api/1/get/statuses/%3Aid/retweeted_by

    // Show user ids of up to 100 users who retweeted the status.
    // https://dev.twitter.com/docs/api/1/get/statuses/%3Aid/retweeted_by/ids

    // Returns up to 100 of the first retweets of a given tweet.
    // https://dev.twitter.com/docs/api/1/get/statuses/retweets/%3Aid

    // Returns a single status, specified by the id parameter below. The status's author will be returned inline.
    // https://dev.twitter.com/docs/api/1/get/statuses/show/%3Aid
    function statusesShow(id, trim_user, include_entities
                          , on_func){
        var content = {};
        if(!isNullOrEmpty(trim_user)){
            content.trim_user = trim_user;
        }
        if(!isNullOrEmpty(include_entities)){
            content.include_entities = include_entities;
        }
        if(!isNullOrEmpty(on_func)){
        }else{
            on_func = responseStatusesShow;
        }
        requestAPI("GET", "URL_STATUSES_SHOW", content, on_func, id);
    }

    // Destroys the status specified by the required ID parameter.
    // https://dev.twitter.com/docs/api/1/post/statuses/destroy/%3Aid

    // Retweets a tweet. Returns the original tweet with retweet details embedded.
    // https://dev.twitter.com/docs/api/1/post/statuses/retweet/%3Aid
    function statusesRetweet(id, include_entities, trim_user){
        var content = {};
        if(!isNullOrEmpty(include_entities)){
            content.include_entities = include_entities;
        }
        if(!isNullOrEmpty(trim_user)) {
            content.trim_user = trim_user;
        }
        requestAPI("POST", "URL_STATUSES_RETWEET"
                   , content, responseStatusesRetweet
                   , id);
    }

    // Updates the authenticating user's status, also known as tweeting.
    // https://dev.twitter.com/docs/api/1/post/statuses/update
    function statusesUpdate(status, in_reply_to_status_id
                    , lat, longi, place_id
                    , display_coordinates, trim_user, include_entities, wrap_links){
        var content = {status: status
                        };
        if(!isNullOrEmpty(in_reply_to_status_id)) {
            content.in_reply_to_status_id = in_reply_to_status_id;
        }
        if(!isNullOrEmpty(lat)){
            content.lat = lat;
        }
        if(!isNullOrEmpty(longi)){
            content.long = longi;
        }
        if(!isNullOrEmpty(place_id)){
            content.place_id = place_id;
        }
        if(!isNullOrEmpty(display_coordinates)){
            content.display_coordinates = display_coordinates;
        }
        if(!isNullOrEmpty(trim_user)){
            content.trim_user = trim_user;
        }
        if(!isNullOrEmpty(include_entities)){
            content.include_entities = include_entities;
        }
        if(!isNullOrEmpty(wrap_links)){
            content.wrap_links = wrap_links;
        }
        // リクエスト
        requestAPI("POST", "URL_STATUSES_UPDATE", content, responseStatusesUpdate);
    }

}
